package cn.jly.spring.annotation.ioc.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

/**
 * @author lanyangji
 * @description cat
 * @date 2020/11/12 下午 5:01
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Cat implements InitializingBean, DisposableBean {
    private String name;

    @Autowired
    private ApplicationContext applicationContext;

    public void destroy() throws Exception {
        System.out.println("Cat.destroy 销毁，，");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("Cat.afterPropertiesSet 初始化，，");
        this.setName("tom");
    }
}
